home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Night Owl 6
/
Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso
/
039a
/
uw201.zip
/
UW_HELP1.HLP
< prev
next >
Wrap
Text File
|
1991-10-07
|
22KB
|
537 lines
`co(4,7);────────────────────────── /// Structures/Globals ──────────────────────────`color();
┌──────────────────────────────────────────────────────────────────────────┐
│ `keyword(RECT,/// RECT); `keyword(WINDOW,/// WINDOW); │
│ `keyword(EVENT,/// EVENT); `keyword(M_RESET,/// M_RESET); │
│ `keyword(M_LOC,/// M_LOC); `keyword(M_MOVE,/// M_MOVE); │
│ `keyword(PRINT,/// PRINT); `keyword(Ega/Vga Globals,/// Ega/Vga Globals); │
│ `keyword(Video Globals,/// Video Globals); `keyword(Event Globals,/// Event Globals); │
│ `keyword(Default Attributes,/// Default Attributes); `keyword(Cursor Globals,/// Cursor Globals); │
│ `keyword(DesqView Globals,/// DesqView Globals); `keyword(Manager Globals,/// Manager Globals); │
└──────────────────────────────────────────────────────────────────────────┘
These are the structures and global variables that are used in the
UltraWin library. The structures defined are those used for the
windowing routines and mouse support. The globals include screen
and video mode variables, Desqview variables for Desqview/Windows
compatibility, and window manager window pointers. Include the
uw_globx.h file for access to the globals, and uw.h for the
structures.
`co(10,1);/// RECT`co();
`co(11,1); typedef struct rect_struct
{
int x_min, x_max, y_min, y_max;
} RECT;`co();
This structure is used for general screen area definition, and is
used internally by the WINDOW struct.
`co(10,1);/// WINDOW`co();
This structure is used by the UltraWin library for all window
operations. The structure is used internally by the library, so
the information below is mainly shown to satisfy any curiosity.
It is recommended that these structure elements be accessed by
the functions provided, where available, and not directly. This
allows us to change and enhance the package in the future while
maintaining compatibility with your code. This is a good
programming practice in any case. Furthermore, we plan to move into
the OOP realm, a good reason not to bypass the "information hiding."
`co(11,1); typedef struct w_struct
{
struct w_struct *next; /* next window in linked list */
struct w_struct *previous; /* previous window in list */
RECT pane; /* the window rectangle */
RECT old_pane; /* for full size toggle */
int rows; /* save buffer rows and columns */
int cols;
int csr_x; /* the "soft" cursor location */
int csr_y;
int att; /* the window's attribute */
int bdr_att; /* the window's border attribute */
int bdr_style; /* the border style */
int name_loc; /* CENTERED, LEFTJUST, RIGHTJUST */
char *name; /* pointer to window name */
char *save; /* pointer to save buffer area */
char *buff; /* pointer to write buffer area */
char *mask; /* pointer to window buffer mask */
uchar *tabs; /* tabs stops */
int reg_s,reg_e; /* scroll region start and end */
unsigned w_wrap : 1; /* word wrap on/off */
unsigned hidden : 1; /* 1 if window hidden */
unsigned overlapped: 1; /* 1 if window overlapped */
unsigned csr_adv : 1; /* advance the cursor */
unsigned csr_on : 1; /* does flashing cursor track? */
unsigned inside : 1; /* 1 if bordered and inside */
unsigned mask_on : 1; /* 1 if window mask is active */
unsigned cr_lf : 1; /* 1 if cr translated to cr/lf */
unsigned full_size : 1; /* 1 if window full sized */
unsigned popup : 1; /* 1 if window is popup */
unsigned scroll : 1; /* 1 if window auto-scrolls */
unsigned bs_clear : 1; /* 1 if backspace is destructive */
unsigned eol_wrap : 1; /* 1 if cursor wraps at end of ln*/
unsigned unused : 3; /* some spare bits */
void *user_ptr; /* user expansion pointer */
uchar user_exp[4]; /* user expansion space */
void *sys_ptr; /* system expansion pointer */
uchar sys_exp[4]; /* system expansion space */
} WINDOW;`co();
`co(10,1);/// EVENT`co();
`co(11,1); typedef struct event_struct
{
char is_mouse;
int key;
int mod;
int m_x, m_y;
char m_count, m_button;
} EVENT;`co();
This structure is used by the global variable "Event", which is
used by wait_event() and event_pending() to return information.
The "is_mouse" member is used as a boolean to indicate if the event
was a keyboard event (is_mouse=0) or a mouse event (is_mouse=1).
The "key" member will contain the key value, and the member "mod"
will contain bit settings to indicate if a key combination was used.
This includes the left and right shift combinations, Ctrl or Alt
combinations, and whether Scroll Lock, Num Lock, or Caps Lock are
set (see uw_keys.h for defines).
The "m_x" and "m_y" members will contain the x,y coordinate (from
0..Vcols-1 for x, 0..Vrows-1 for y) of the mouse event, m_count will
contain the number of presses, and m_button has the button pressed
(LB, MB, or RB).
`co(10,1);/// M_RESET`co();
`co(11,1); typedef struct reset_struct
{
int exists;
int n_buttons;
} M_RESET;`co();
This structure is used internally by the init_mouse() and end_mouse()
functions. It is used when starting or ending the program, and when
first called returns if the mouse is available. The function
init_mouse() uses this structure to set the global Mouse_exists
boolean variable.
`co(10,1);/// M_LOC`co();
`co(11,1); typedef struct loc_struct
{
int button_status;
int count;
int col;
int row;
} M_LOC;`co();
This structure is used by m_pos, m_pressed, and m_released, as well
as internally by event_pending. If you want to handle the mouse
yourself, bypassing UltraWin's event handling capability, use the
m_pos, m_pressed and m_released functions to get mouse pressed and
coordinate information using a variable of type M_LOC.
`co(10,1);/// M_MOVE`co();
`co(11,1); typedef struct move_struct
{
int h_count;
int v_count;
} M_MOVE;`co();
This structure is used only by the m_motion function, which reports
the net movement of the mouse cursor between m_motion calls.
`co(10,1);/// PRINT`co();
typedef struct printer
{
int active; /* set to 1 if printer init'd/active */
int halt; /* set to 1 to temporarily stop printer */
int prt_dev; /* file handle for printer device */
char device[81]; /* name of printer device */
int prt_buff[2]; /* file handles for printer buffer */
char buffer[81]; /* name of printer buffer */
int cr_cnt; /* number of carriage returns to send */
int lf_cnt; /* number of line feeds to send */
int block_mode; /* allows faster output on block devices*/
long max_que_size; /* maximum size of print que */
long init_que_size; /* initial size of print que */
long curr_que_size; /* current size of print que */
long read; /* print que read index */
long write; /* print que write index */
long cnt; /* print que cnt (number of bytes in q) */
uchar *que; /* pointer to print que data */
uchar *xlat; /* pointer to translation table */
int xlat_flag; /* translation flag */
} PRINT;
This structure is used by the print routines in uw_print.c. For further
information, see `keyword(Print Support,[uw_help6.hlp]/// Print Support);.
`co(10,1);/// Video Globals`co();
`co(11,1); uchar far *Screen;`co();
This is a far pointer to the video display area. It's value will
depend on if you are using a monochrome or color display, and whether
a control program like Windows or Desqview is being used. You may
modify this variable to redirect output anywhere in memory, but be
careful to use an area you are sure is safe.
`co(11,1); int V_mode;`co();
This is an integer that contains the text mode that was used before
the call to init_video or force_video. This is saved in V_mode and
is used in the call to end_video to restore the original mode.
`co(11,1); uchar V_cols, V_rows;`co();
These two variables contain the number of columns and rows available
on the text screen, and are set by the init_video and force_video
functions. The video screen is therefore defined as 0..V_cols-1 and
0..V_rows-1!
`co(10,1);/// Event Globals`co();
`co(11,1); EVENT Event;`co();
This global variable is used by the event_pending() and wait_event()
functions to pass back information about the type of event as well
as mouse/keyboard information.
`co(11,1); int Mouse_exists;`co();
This global variable is set by the init_mouse function to either
TRUE (1) or FALSE (0) depending on whether a Microsoft or compatible
mouse is connected.
`co(10,1);/// Default Attributes`co();
`co(11,1); uchar Dflt_att, Dflt_bdr_att;`co();
These attributes are used to set the default window colors when
wn_create is called. If you do not use the wn_color and wn_bdr_color
macros to set the window colors, you will get these default
attributes.
`co(10,1);/// Cursor Globals`co();
`co(11,1); int Csr_visible;`co();
This boolean is either TRUE (1) or FALSE (0) depending on whether
the hardware cursor is visible.
`co(11,1); int Csr_in_use;`co();
This boolean is either TRUE (1) or FALSE (0) depending on whether
the hardware cursor is being used. The window input routine
wn_gets sets this variable to TRUE while the cursor is being used,
then sets it back to FALSE when finished.
`co(10,1);/// DesqView Globals`co();
int DV_seg, DV_off, DV_flag, DV_upd;
These are integers that are used to maintain DesqView compatibility.
They are used internal to the library.
`co(10,1);/// Manager Globals`co();
`co(11,1); WINDOW *First_window, *Last_window`co();
These are pointers to the first and last windows in the window
manager's linked list. These are NULL on startup, and are set
by the add_window and remove_window functions as windows are added
to the manager. You can use these to determine the top window
(Last_window) or the bottom window (First_window) at any time when
using the manager.
`co(4,7);────────────────────────── /// Video Initialization ────────────────────────`co();
┌──────────────────────────────────────────────────────────────────────────┐
│ `keyword(init_video,/// init_video); `keyword(force_video,/// force_video); │
│ `keyword(end_video,/// end_video); `keyword(set_vid_addr,/// set_vid_addr); │
└──────────────────────────────────────────────────────────────────────────┘
These functions allow you to initialize the text screen to a
specific mode, and return back to the mode in use before the
initialization. Initialization of the text screen is the first step
that should be taken in a C program that utilizes the UltraWin
library.
The UltraWin library supports 80x25 Monochrome and Color modes,
as well as the 80x43 EGA color and 80x50 VGA color mode. Higher
resolution text screens that some of the new VGA cards can produce
are also supported.
`co(10,1);/// init_video`co(); `keyword(source,[UW_VID.C]~init_video);
Initializes the text screen to a specific mode, specified not by
mode number, but by number of columns and rows. The video mode that
best matches the number of columns and rows passed will be
selected. The function will set the two global variables V_cols
and V_rows to the actual number that are available. This allows
the user to specify an 80x50 screen, and have init_video set the
closest text mode to this size that your video card will
accomodate.
Prototype:
void init_video(int cols, int rows);
Parameters:
`co(11,1); int cols, int rows`co();
The number of columns and rows desired for the screen.
Usage:
init_video( 80, 50 );
`co(10,1);/// force_video`co(); `keyword(source,[UW_VID.C]~force_video);
This function is similar to init_video, except the text bios mode
number is passed as well as the number of columns and rows. This
allows one of the non-standard VGA modes (specific to your VGA
card) to be set.
Prototype:
void force_video( int force_mode, int cols, int rows );
Parameters:
`co(11,1); int force_mode`co();
The actual mode number listed in the manual for your video board.
`co(11,1); int cols, int rows`co();
The number of columns and rows desired for the screen.
Usage:
force_video( 0x60, 132, 60 );
`co(10,1);/// end_video`co(); `keyword(source,[UW_VID.C]~end_video);
Restores the video mode in use before the call to init_video. Call
this function just before you exit your program.
Prototype:
void end_video();
Parameters:
None.
Usage:
end_video();
`co(10,1);/// set_vid_addr`co(); `keyword(source,[UW_VID.C]~set_vid_addr);
This routine overrides the default video address and sets it to the
desired segment and offset.
Prototype:
void set_vid_addr( int segment, int offset );
Parameters:
`co(11,1); int segment, offset`co();
The desired segment and offset for your new video address.
Usage:
`co(11,1); uchar far *old_screen;`co();
...
old_screen = Screen;
set_vid_addr( 0xB000, 0x8000 );
...
Screen = old_screen;
`co(4,7);────────────────────────── /// Window Maintenance ──────────────────────────`co();
┌──────────────────────────────────────────────────────────────────────────┐
│ `keyword(wn_create,/// wn_create); `keyword(wn_set,/// wn_set); │
│ `keyword(wn_clear,/// wn_clear); `keyword(wn_border,/// wn_border); │
│ `keyword(wn_move,/// wn_move); `keyword(set_mask,/// set_mask); │
│ `keyword(clear_mask,/// clear_mask); `keyword(wn_destroy,/// wn_destroy); │
└──────────────────────────────────────────────────────────────────────────┘
These are the functions used for window creation, destruction,
and placement on the text screen. There are special functions that
allow you to "mask off" sections of a window so that output does
not occur to that area, as well as restoring what was behind a
window when it was created.
`co(10,1);/// wn_create`co(); `keyword(source,[UW_WN.C]~wn_create);
This function will create a window with the size determined by the
upper left and lower right coordinates passed by integer. Several
border styles can be used, as well as a mode for saving what is
behind the window, to be restored on window destruction. Please
note that wn_create does not allocate the window for you, you must
declare your windows yourself either as locals/globals, passing the
address of the window to wn_create, or as pointers that are
"malloc"ed or "calloc"ed, passing the pointer to wn_create.
Prototype:
void wn_create( int x_min, int y_min, int x_max, int y_max,
int bdr, int mode, WINDOW *wnp );
Parameters:
`co(11,1); int x_min, int y_min, int x_max, int y_max`co();
The coordinates of the upper left and lower right corners of the
window to create. These range from 0,0 (upper left corner of
the screen) to the max number of columns and rows minus one
(lower right corner of the screen).
`co(11,1); int bdr`co();
The border style to use, namely one of the defines NO_BDR,
SGL_BDR, DBL_BDR, SLD_BDR, or DUAL_BDR.
`co(11,1); int mode`co();
The popup mode, can be either WN_NORMAL or WN_POPUP. Normal
windows when destroyed do not restore what is behind them, while
popup windows do. Normal windows therefore use less memory.
`co(11,1); WINDOW *wnp`co();
A pointer to the window. Can be the address of a global variable
of type WINDOW, or a pointer that has been allocated with malloc
or calloc. The wn_create function will initialize the contents
of the window for you, so all that is necessary is to pass it to
this function!
Usage:
WINDOW *wnp;
...
wn_create( 0, 0, 79, 24, SGL_BDR, POPUP, wnp );
`co(10,1);/// wn_set`co(); `keyword(source,[UW_WN.C]~wn_set);
This function sets the window on the screen, saving the contents of
what's behind the window if it was defined as WN_POPUP when created
with wn_create.
Prototype:
void wn_set( WINDOW *wnp );
Parameters:
`co(11,1); WINDOW *wnp`co();
A pointer to the window, or address of a WINDOW variable.
Usage:
WINDOW *wnp;
...
wn_set( wnp );
`co(10,1);/// wn_clear`co(); `keyword(source,[UW_WN.C]~wn_clear);
This function clears the contents of a window, excluding the border,
if present. The window must be first created with wn_create, then
set on the video screen with wn_set.
Prototype:
void wn_clear( WINDOW *wnp );
Parameters:
`co(11,1); WINDOW *wnp`co();
A pointer to the window.
Usage:
WINDOW *wnp;
...
wn_clear( wnp );
`co(10,1);/// wn_border`co(); `keyword(source,[UW_BDR.C]~wn_border);
This function draws the border to the window, if the window border
exists (call wn_create with something besides NO_BDR, or set the
bdr_style field of the window to one of the border defines).
Use this function to redraw the border.
Prototype:
void wn_border( WINDOW *wnp );
Parameters:
`co(11,1); WINDOW *wnp`co();
A pointer to the window.
Usage:
WINDOW *wnp;
...
wn_border( wnp );
`co(10,1);/// wn_move`co(); `keyword(source,[UW_WN.C]~wn_move);
Take a window that has been placed on the video screen with wn_set,
and move it to a new location. Please note that the background
will be restored for you when the window is moved if you create the
window with the WN_POPUP value as the mode parameter to wn_create.
Prototype:
wn_move( int col, int row, WINDOW *wnp );
Parameters:
`co(11,1); int col, row`co();
The column and row where the window is to be moved. This location
is where the upper left hand corner of the window will be placed.
WINDOW *wnp
A pointer to the window to move.
Usage:
WINDOW *wnp;
...
wn_move( 3, 7, wnp );
`co(10,1);/// set_mask`co(); `keyword(source,[UW_MASK.C]~set_mask);
This function is to be called when a window is added on top of
another window. The function will see if the second window (top)
overlaps the first window (bottom), and masks off for output the
area that overlaps. If the windows are not overlapped, then no
masking is necessary, and the mask is not performed. Masking the
bottom window prevents output to the region of the bottom window
overlapped, giving the appearance that the window updates "in the
background". Call set_mask on a window for each window that is
to be displayed "on top" of it. You do not need to use this
function when using the window manager, as it takes care of all
masking when a window is added or removed!
Prototype:
void set_mask( int mode, WINDOW *wnp1, WINDOW *wnp2 );
Parameters:
`co(11,1); int mode`co();
A value 1 (ON) or 0 (OFF) to indicate if the mask is to be added
or removed.
`co(11,1); WINDOW *wnp1`co();
The window for which the mask is to be set (the "bottom" one).
`co(11,1); WINDOW *wnp2`co();
The window used to set the mask of the bottom window. (The top
window).
Usage:
WINDOW bottom_win, top_win;
...
set_mask(ON, &bottom_win, &top_win);
set_mask(OFF, &bottom_win, &top_win);
`co(10,1);/// clear_mask`co(); `keyword(source,[UW_MASK.C]~clear_mask);
This function clears the mask for the window passed. All areas of
the window will change when the window is refreshed, or when any
information is written to the window, the window scrolls, etc.
The window manager will clear any masks necessary when you add or
delete windows.
Prototype:
void clear_mask( WINDOW *wnp );
Parameters:
`co(11,1); WINDOW *wnp1`co();
A pointer to type WINDOW that specifies the window to clear.
Usage:
WINDOW win;
...
clear_mask( &win );
`co(10,1);/// wn_destroy`co(); `keyword(source,[UW_WN.C]~wn_destroy);
This function restores what was behind the window before wn_create
(if it was defined using WN_POPUP), and deallocates memory used by
the window. Be sure you destroy any temporary window that you have
created with wn_create, or you will consume valuable memory if you
do not. This is also good practice at the end of your program,
before calling end_video and returning to DOS.
Prototype:
void wn_destroy( WINDOW *wnp );
Parameters:
`co(11,1); WINDOW *wnp`co();
A pointer to the window, or address of a WINDOW variable.
Usage:
WINDOW *wnp;
...
wn_destroy( wnp );
`co(4,7);─ End ──────────────────────────────────────────────────────────────────────`co();`sound(1024,10);